<!DOCTYPE html>


<html lang="zh-CN">


<head>
  <meta charset="utf-8" />
    
  <meta name="description" content="welcome" />
  
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
  <title>
    使用Git搭建个人博客 |  ChenyyのBlog
  </title>
  <meta name="generator" content="hexo-theme-ayer">
  
  <link rel="shortcut icon" href="/favicon.ico" />
  
  
<link rel="stylesheet" href="/dist/main.css">

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/Shen-Yu/cdn/css/remixicon.min.css">
  
<link rel="stylesheet" href="/css/custom.css">

  
  <script src="https://cdn.jsdelivr.net/npm/pace-js@1.0.2/pace.min.js"></script>
  
  

  

</head>

</html>

<body>
  <div id="app">
    
      
    <main class="content on">
      <section class="outer">
  <article
  id="post-blog/使用Git搭建个人博客"
  class="article article-type-post"
  itemscope
  itemprop="blogPost"
  data-scroll-reveal
>
  <div class="article-inner">
    
    <header class="article-header">
       
<h1 class="article-title sea-center" style="border-left:0" itemprop="name">
  使用Git搭建个人博客
</h1>
 

    </header>
     
    <div class="article-meta">
      <a href="/2021/02/02/blog/%E4%BD%BF%E7%94%A8Git%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/" class="article-date">
  <time datetime="2021-02-02T13:21:58.000Z" itemprop="datePublished">2021-02-02</time>
</a> 
  <div class="article-category">
    <a class="article-category-link" href="/categories/blog/">blog</a>
  </div>
  
<div class="word_count">
    <span class="post-time">
        <span class="post-meta-item-icon">
            <i class="ri-quill-pen-line"></i>
            <span class="post-meta-item-text"> 字数统计:</span>
            <span class="post-count">2.8k</span>
        </span>
    </span>

    <span class="post-time">
        &nbsp; | &nbsp;
        <span class="post-meta-item-icon">
            <i class="ri-book-open-line"></i>
            <span class="post-meta-item-text"> 阅读时长≈</span>
            <span class="post-count">12 分钟</span>
        </span>
    </span>
</div>
 
    </div>
      
    <div class="tocbot"></div>




  
    <div class="article-entry" itemprop="articleBody">
       
  <ul>
<li>为什么要搭建个人博客</li>
<li>准备工作</li>
<li>使用Hexo、Node.js、Git搭建个人博客</li>
</ul>
<span id="more"></span>

<h1 id="为什么要搭建个人博客"><a href="#为什么要搭建个人博客" class="headerlink" title="为什么要搭建个人博客"></a>为什么要搭建个人博客</h1><ul>
<li>好记性不如烂笔头，方便日后整理回顾</li>
<li>免费方便，不需要服务器不需要后台，不需要依赖除了git的外部服务</li>
<li>可以随意绑定自己的域名，不仔细看的话根本看不出来你的网站是基于github的</li>
<li>数据绝对安全，基于github的版本管理，想恢复到哪个历史版本都行</li>
<li>博客内容可以轻松打包、转移、发布到其它平台</li>
<li>全是静态文件，访问速度快</li>
<li><a target="_blank" rel="noopener" href="http://mindhacks.cn/2009/02/15/why-you-should-start-blogging-now/">为什么写博客</a><strong>：</strong><a target="_blank" rel="noopener" href="http://mindhacks.cn/2009/02/15/why-you-should-start-blogging-now/">http://mindhacks.cn/2009/02/15/why-you-should-start-blogging-now/</a> </li>
</ul>
<h1 id="准备工作"><a href="#准备工作" class="headerlink" title="准备工作"></a>准备工作</h1><p>\1. Git <strong>下载</strong>（Git for windows <strong><a target="_blank" rel="noopener" href="https://github.com/waylau/git-for-win">国内下载</a><strong>）、</strong><a target="_blank" rel="noopener" href="https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%AE%89%E8%A3%85-Git">安装</a><strong>（安装时请勾选</strong>Add to PATH</strong>选项）、**<a target="_blank" rel="noopener" href="https://git-scm.com/book/zh/v2/%E8%B5%B7%E6%AD%A5-%E5%88%9D%E6%AC%A1%E8%BF%90%E8%A1%8C-Git-%E5%89%8D%E7%9A%84%E9%85%8D%E7%BD%AE">配置</a><strong>、</strong><a target="_blank" rel="noopener" href="https://git-scm.com/book/zh/v2/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-%E7%94%9F%E6%88%90-SSH-%E5%85%AC%E9%92%A5">生成SSH公钥</a>**</p>
<p>\2. Github <strong><a target="_blank" rel="noopener" href="https://github.com/join?source=header-home">账号申请</a></strong> / Gitee（码云）**<a target="_blank" rel="noopener" href="https://gitee.com/login">账号申请</a>**<strong>、<a target="_blank" rel="noopener" href="https://desktop.github.com/">GitHub Windows客户端</a><strong>、</strong><a target="_blank" rel="noopener" href="https://git-scm.com/book/zh/v2/GitHub-%E8%B4%A6%E6%88%B7%E7%9A%84%E5%88%9B%E5%BB%BA%E5%92%8C%E9%85%8D%E7%BD%AE">配置SSH Keys</a></strong></p>
<p>\3. Node.js <strong><a target="_blank" rel="noopener" href="https://nodejs.org/en/">下载安装</a></strong></p>
<p>\4. 文件编辑器 <strong><a target="_blank" rel="noopener" href="http://markdownpad.com/">Markdown</a> / <a target="_blank" rel="noopener" href="https://www.typora.io/">Typora</a> / <a target="_blank" rel="noopener" href="http://www.sublimetext.com/3">Sublime Text</a> / <a target="_blank" rel="noopener" href="https://notepad-plus-plus.org/downloads/">Notepad++</a></strong></p>
<h1 id="使用Hexo、Node-js、Git搭建个人博客"><a href="#使用Hexo、Node-js、Git搭建个人博客" class="headerlink" title="使用Hexo、Node.js、Git搭建个人博客"></a>使用Hexo、Node.js、Git搭建个人博客</h1><h2 id="HEXO-安装"><a href="#HEXO-安装" class="headerlink" title="HEXO 安装"></a>HEXO 安装</h2><p>Hexo 是一个快速、简洁且高效的Node.js静态博客框架。Hexo 使用 **<a target="_blank" rel="noopener" href="http://daringfireball.net/projects/markdown/">Markdown</a>**（或其他渲染引擎）解析文章，在几秒内，即可利用靓丽的主题生成静态网页。</p>
<p>本教程Hexo 安装版本为：vs_3.4.3；Node.js 版本为：vs_8.9.3。安装 Hexo 之前请先确保 Git 及 Node.js 安装成功，接下来只需要使用 <strong><a target="_blank" rel="noopener" href="http://www.runoob.com/nodejs/nodejs-npm.html">NPM</a></strong> 即可完成 Hexo 的安装。</p>
<p>在计算机新建一个文件夹作为本地仓库，进入到文件夹 中单击右键，选择 “Git Bash Here” ， 进入Git Bash进行<strong>Hexo 下载：</strong></p>
<p>方法一：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">安装cnpm</span><br><span class="line">$ npm install -g cnpm --registry=https://registry.npm.taobao.org</span><br><span class="line"></span><br><span class="line">使用cnpm安装hexo</span><br><span class="line">$ cnpm install -g hexo-cli</span><br></pre></td></tr></table></figure>



<p>方法二：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">$ npm install -g hexo-cli</span><br><span class="line"></span><br><span class="line">如果安装失败，尝试切换安装源后再执行安装命令 npm install -g hexo-cli</span><br><span class="line"></span><br><span class="line">官方源：</span><br><span class="line">npm config set registry https://registry.npmjs.org/</span><br><span class="line"></span><br><span class="line">淘宝镜像：</span><br><span class="line">npm config set registry http://registry.npm.taobao.org/</span><br></pre></td></tr></table></figure>



<p>注：如果提示权限错误，命令前加<code>sudo</code>,<code>cnpm</code> 是淘宝的开源镜像，国内访问比<code>npm</code>快。</p>
<p>Hexo 更新至最新版本，命令如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm update hexo -g</span><br></pre></td></tr></table></figure>



<p>确认cnpm的版本和Hexo 版本信息，查看是否安装完成</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ cnpm -v</span><br><span class="line"></span><br><span class="line">$ hexo -v</span><br></pre></td></tr></table></figure>



<h2 id="HEXO-初始化及本地启动"><a href="#HEXO-初始化及本地启动" class="headerlink" title="HEXO 初始化及本地启动"></a>HEXO 初始化及本地启动</h2><p>执行下列初始化命令，Hexo 将会在当前文件夹中生成一个名为blog的文件（可以根据需要修改命令即可修文件名），文件内容包括：node_modules、scaffolds、source、themes等文件</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo init blog</span><br><span class="line">$ cd blog</span><br><span class="line">$ npm install</span><br></pre></td></tr></table></figure>



<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo generate</span><br></pre></td></tr></table></figure>



<p>新建完成后，指定文件夹的目录如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line">.</span><br><span class="line"></span><br><span class="line">├── _config.yml 网站的配置信息，您可以在此配置大部分的参数</span><br><span class="line"></span><br><span class="line">├── package.json 应用程序的信息</span><br><span class="line"></span><br><span class="line">├── scaffolds 模板文件夹</span><br><span class="line"></span><br><span class="line">├── source 资源文件夹，存放用户资源</span><br><span class="line"></span><br><span class="line">|   ├── _drafts</span><br><span class="line"></span><br><span class="line">|   └── _posts</span><br><span class="line"></span><br><span class="line">└── themes 网站主题文件夹</span><br></pre></td></tr></table></figure>



<p>接着输入命令启动服务：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo server</span><br></pre></td></tr></table></figure>



<p>打印信息如下表示服务启动成功：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">INFO  Start processing</span><br><span class="line"></span><br><span class="line">INFO  Hexo is running at http://localhost:4000/. Press Ctrl+C to stop.</span><br></pre></td></tr></table></figure>



<p>然后在浏览器中访问：**<a target="_blank" rel="noopener" href="http://localhost:4000/**%EF%BC%8C%E5%A6%82%E6%9E%9C4000%E7%AB%AF%E5%8F%A3%E8%A2%AB%E5%8D%A0%E7%94%A8%EF%BC%8C%E5%8F%AF%E4%BB%A5%E6%9B%B4%E6%94%B9%E7%AB%AF%E5%8F%A3%E5%8F%B7%E4%B8%BA8081">http://localhost:4000/**，如果4000端口被占用，可以更改端口号为8081</a></p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">$ hexo s --p 8081</span><br><span class="line"></span><br><span class="line">INFO  Start processing</span><br><span class="line"></span><br><span class="line">INFO  Hexo is running at http://localhost:8081/. Press Ctrl+C to stop.</span><br></pre></td></tr></table></figure>



<p>如果博客出现中文乱码，使用编辑器编辑 <strong>_config.yml</strong> 文件，设置编辑器的编码为 <strong>UTF-8</strong> 后进行保存即可。</p>
<h2 id="hexo搜索功能"><a href="#hexo搜索功能" class="headerlink" title="hexo搜索功能"></a>hexo搜索功能</h2><p><strong>安装插件</strong></p>
<p>到博客根目录打开Git bash here执行安装命令</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">cnpm install hexo-generator-searchdb –save</span><br></pre></td></tr></table></figure>



<p><strong>修改站点配置文件</strong></p>
<p>打开_config.yml 配置文件，在最底下添加下面代码</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">search:</span><br><span class="line">  path: search.xml</span><br><span class="line">  field: post</span><br><span class="line">  format: html</span><br><span class="line">  limit: 10000</span><br></pre></td></tr></table></figure>



<blockquote>
<p>path：表示搜索后生成的文件路径，可以生成xml和json两种格式；search.xml不可以就改为search.json</p>
<p>field：表示搜索的范围，有“post、page和all”三种值。</p>
<p>    post：所有的文章；</p>
<p>    page：所有顶部导航选项的页面；</p>
<p>    all：所有的文章和顶部导航选项的页面。</p>
<p>content：是否包含搜索到的文章的全部内容。如果false，生成的结果只包括标题和创建时间这些信息，没有文章主体。默认情况下是true.</p>
<p>format：搜索到的内容、选项的格式。</p>
<p>    html(默认)：将html原文本缩略。</p>
<p>    striptags：将html原文本缩略，并删除所有标记。</p>
<p>    raw：记下每一篇文章或每一页的文字。</p>
</blockquote>
<p><strong>使用插件</strong></p>
<p>打开博客目录目录，找到当前正在使用的主题的“_config.yml”文件，打开进行编辑，找到“local_search”,<br>不同模板这个字段可能不同，修改enable的值为true。</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"># 本地搜索</span><br><span class="line">search_box: </span><br><span class="line">  enable: true</span><br></pre></td></tr></table></figure>





<h2 id="编写博文"><a href="#编写博文" class="headerlink" title="编写博文"></a>编写博文</h2><p>进入\source_posts文件下新建后缀为.md的markdown文件，编辑并保存，这就是一篇新的博文</p>
<p>也可以通过命令创建，常见命令如下</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line">hexo new &quot;postName&quot; #新建文章</span><br><span class="line">hexo new page &quot;pageName&quot; #新建页面，不会作为文章出现在博文目录。</span><br><span class="line">hexo generate #生成静态页面至public目录</span><br><span class="line">hexo server #开启预览访问端口（默认端口4000，&#x27;ctrl + c&#x27;关闭server）</span><br><span class="line">hexo deploy #部署到GitHub</span><br><span class="line">hexo help  # 查看帮助</span><br><span class="line">hexo version  #查看Hexo的版本</span><br></pre></td></tr></table></figure>



<p>如果博客的样式不对，尝试在_config.yml中配置下博客地址和路径：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">url: https://github.com/用户名/用户名.github.io.git/blog/</span><br><span class="line">root: /blog</span><br></pre></td></tr></table></figure>





<h2 id="Hexo-部署至-Github"><a href="#Hexo-部署至-Github" class="headerlink" title="Hexo 部署至 Github"></a><strong>Hexo 部署至 Github</strong></h2><p>新建仓库 new repository ，命名为<code>你的用户名.github.io</code>（必须是你的用户名，其它名称无效，邮箱需要认证）</p>
<p><img src="https://img-blog.csdnimg.cn/20210204140255703.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODAwNDYzOA==,size_16,color_FFFFFF,t_70" alt="img"><img src="" alt="点击并拖拽以移动"></p>
<p>创建好仓库后，复制仓库地址：github.com/用户名/用户名.github.io.git</p>
<p>修改 _config.yml 配置文件 <strong>，</strong>打开文件后找到 deploy， 修改如下：（<strong>注意冒号后面有一个空格：</strong> ）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"># Deployment</span><br><span class="line">## Docs: https://hexo.io/docs/deployment.html</span><br><span class="line">deploy:</span><br><span class="line">  type: git</span><br><span class="line">  ##repo: https://gitee.com/用户名/用户名.git</span><br><span class="line">  repo: https://github.com/用户名/用户名.github.io.git</span><br><span class="line">  branch: master</span><br><span class="line">  message: </span><br></pre></td></tr></table></figure>

<p><img src="" alt="点击并拖拽以移动"></p>
<p>编辑完成后进行保存，接着安装自动部署发布工具 **<a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-deployer-git">hexo-deployer-git</a>**，命令如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ npm install hexo-deployer-git --save</span><br></pre></td></tr></table></figure>



<p>等待安装完成以后，执行如下配置命令：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>



<p>发布新博客或者更新配置文件，需要重新部署一下，首次发布需要输入账号和密码，命令如下：</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br><span class="line">$ hexo generate</span><br><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>





<p>在Github的上边栏选择Settings</p>
<p><img src="https://img-blog.csdnimg.cn/20210204140438167.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODAwNDYzOA==,size_16,color_FFFFFF,t_70" alt="img"><img src="" alt="点击并拖拽以移动"></p>
<p>找到GitHub pages设置界面</p>
<p><img src="https://img-blog.csdnimg.cn/20210204140528330.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODAwNDYzOA==,size_16,color_FFFFFF,t_70" alt="img"><img src="" alt="点击并拖拽以移动"></p>
<p>按如图所示选择，注意，选择source之后记得Save，然后点击Choose a theme选择一个博客主题，然后点击Select theme</p>
<p><img src="https://img-blog.csdnimg.cn/20210204140552283.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODAwNDYzOA==,size_16,color_FFFFFF,t_70" alt="img"><img src="" alt="点击并拖拽以移动"></p>
<p>在Gitee中选择服务下面的Gitee Pages，进行服务部署</p>
<p><img src="https://img-blog.csdnimg.cn/20210204155945708.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl8zODAwNDYzOA==,size_16,color_FFFFFF,t_70" alt="img"><img src="" alt="点击并拖拽以移动"></p>
<p>发布完成，在Github/Gitee中部署项目</p>
<p>正常部署完成后打开浏览器输入：【https://您的 Github 名称/github.io】进行访问，例如：**<a target="_blank" rel="noopener" href="https://maugerwu.github.io/">https://用户名.github.io</a>**。</p>
<h2 id="修改Hexo-配置及博客主题"><a href="#修改Hexo-配置及博客主题" class="headerlink" title="修改Hexo 配置及博客主题"></a>修改Hexo 配置及博客主题</h2><p><strong>修改配置</strong></p>
<ul>
<li>title 网站标题</li>
<li>subtitle 网站副标题</li>
<li>keywords 网站的关键词。支援多个关键词。</li>
<li>description 网站描述 。主要用于SEO，告诉搜索引擎一个关于您站点的简单描述，通常建议在其中包含您网站的关键词</li>
<li>author 您的名字 。用于主题显示文章的作者</li>
<li>language 网站使用的语言 。常见的有 zh-Hans和 zh-CN。</li>
<li>timezone 网站时区。默认使用您电脑的时区，对于中国大陆地区可以使用 <code>Asia/Shanghai</code>。</li>
</ul>
<p>其他相关详细配置信息请参考 <strong><a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/configuration.html">Hexo 配置</a> ：</strong><a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/configuration.html">https://hexo.io/zh-cn/docs/configuration.html</a></p>
<p><strong>选择主题</strong></p>
<p>使用的主题都是放在/themes这个目录下，Hexo默认使用的是<code>landscape</code>主题，下载新的主题下来后，解压放入/themes文件夹下</p>
<p>选择一个自己喜欢的Hexo主题 <strong>：</strong><a target="_blank" rel="noopener" href="https://hexo.io/themes/%EF%BC%9Bhttps://github.com/hexojs/hexo/wiki/Themes">https://hexo.io/themes/；https://github.com/hexojs/hexo/wiki/Themes</a></p>
<p>输入命令克隆主题：<code>git clone https://gitee.com/xiuxiuing/hexo-theme-even themes/even ，</code>完成后可以看到/themes下新增了<code>even</code> 文件夹。</p>
<p>以下为推荐主题：</p>
<ul>
<li>alpha-dust<a target="_blank" rel="noopener" href="http://www.codeblocq.com/assets/projects/hexo-theme-alpha-dust/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/klugjo/hexo-theme-alpha-dust">https://github.com/klugjo/hexo-theme-alpha-dust</a></li>
<li>anatole-core<a target="_blank" rel="noopener" href="https://www.jixian.io/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/mrcore/hexo-theme-Anatole-Core">https://github.com/mrcore/hexo-theme-Anatole-Core</a></li>
<li>arknights<a target="_blank" rel="noopener" href="http://ark.theme.yueplus.ink/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/Yue-plus/hexo-theme-arknights">https://github.com/Yue-plus/hexo-theme-arknights</a></li>
<li>ayer<a target="_blank" rel="noopener" href="https://shen-yu.gitee.io/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/Shen-Yu/hexo-theme-ayer">https://github.com/Shen-Yu/hexo-theme-ayer</a></li>
<li>black-blue-master<a target="_blank" rel="noopener" href="https://luuman.github.io/categories/Hexo/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/luuman/hexo-theme-spfk">https://github.com/luuman/hexo-theme-spfk</a></li>
<li>butterfly<a target="_blank" rel="noopener" href="https://butterfly.js.org/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">https://github.com/jerryc127/hexo-theme-butterfly</a></li>
<li>Cxo<a target="_blank" rel="noopener" href="https://longlongyu.github.io/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/Longlongyu/hexo-theme-Cxo">https://github.com/Longlongyu/hexo-theme-Cxo</a></li>
<li>hexo-theme-fluid<a target="_blank" rel="noopener" href="https://zkqiang.cn/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/fluid-dev/hexo-theme-fluid">https://github.com/fluid-dev/hexo-theme-fluid</a></li>
<li>magnetic<a target="_blank" rel="noopener" href="http://www.codeblocq.com/assets/projects/hexo-theme-magnetic/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/klugjo/hexo-theme-magnetic">https://github.com/klugjo/hexo-theme-magnetic</a></li>
<li>volantis<a target="_blank" rel="noopener" href="https://lishaojie1993.gitee.io/">预览</a>：<a target="_blank" rel="noopener" href="https://github.com/volantis-x/hexo-theme-volantis/">https://github.com/volantis-x/hexo-theme-volantis/</a></li>
</ul>
<p>其他主题：</p>
<ul>
<li><p><a target="_blank" rel="noopener" href="http://github.com/xing5/hexo-theme-animastars">AnimaStars</a> - Add amazing star rotation animation to the official Landscape theme along with some changes on font and colors. - <em><a target="_blank" rel="noopener" href="http://demo.xingwu.me/animastars/">Demo</a></em></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/coneycode/coney">Coney</a> - A theme based on <a target="_blank" rel="noopener" href="https://github.com/A-limon/pacman">Pacman</a>,especially for Chinese! change the display style, add baidu share module, baidu search module, baidu analytics module, up to top button and so on. - <a target="_blank" rel="noopener" href="http://gengbiao.me/coney"><em>Demo</em></a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/hsihohuang/kiddochan">Kiddochan</a> - A simple, flexible and responsive theme for Hexo based on <a target="_blank" rel="noopener" href="https://github.com/wuchong/jacman">Jacman</a>. - <a target="_blank" rel="noopener" href="http://blog.hsihohuang.info/"><em>Demo</em></a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/hsihohuang/kiddochan">Kiddochan</a> - A simple, flexible and responsive theme for Hexo based on <a target="_blank" rel="noopener" href="https://github.com/wuchong/jacman">Jacman</a>. - <a target="_blank" rel="noopener" href="http://blog.hsihohuang.info/"><em>Demo</em></a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/HipHopCoderS/Landscape-x">Landscape-x</a> - A fresh looking and responsive theme for Hexo, Modification of Landscape plus theme - <a target="_blank" rel="noopener" href="http://blog.rapcoder.com/"><em>Demo</em></a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/idhyt/hexo-theme-next/tree/magiclamp">Mala</a> - I’m Magic Lamp, Dark theme, one key switch to White theme. <a target="_blank" rel="noopener" href="http://blog.idhyt.com/">Demo</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/iissnan/hexo-theme-next">NexT</a> - High quality elegant theme. - <a target="_blank" rel="noopener" href="http://notes.iissnan.com/">Demo</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/techlahoma/hexo-theme-okcjs">Okcjs</a> - Site with an animated banner based in the <a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-theme-landscape">Landscape</a> layout, but modified. <a target="_blank" rel="noopener" href="http://okcjs.com/">Demo</a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/winterland1989/hexo-theme-winterland">Winterland</a> - A minimalistic theme based on <a target="_blank" rel="noopener" href="https://github.com/hexojs/hexo-theme-light">Light</a> with living background - <a target="_blank" rel="noopener" href="http://www.winterland.me/"><em>Demo</em></a></p>
</li>
<li><p><a target="_blank" rel="noopener" href="https://github.com/litten/hexo-theme-yilia">Yilia</a> - Responsive and simple style 优雅简洁响应式主题，配置更新请参考：<a target="_blank" rel="noopener" href="http://wuchong.me/jacman/how-to-use-jacman/">Jacman Theme</a></p>
</li>
</ul>
<p><strong>主题更新</strong></p>
<p>修改_config.yml文档内容中theme的值，将默认主题修改为下载的主题名（即/<code>themes/下的</code>文件名称）</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"># Extensions</span><br><span class="line">## Plugins: https://hexo.io/plugins/</span><br><span class="line">## Themes: https://hexo.io/themes/</span><br><span class="line">## theme: landscape</span><br><span class="line">theme: even</span><br></pre></td></tr></table></figure>

<p>本地启动时，主题更新需要将服务重启。部署到GitHub后，进入到主题文件夹的目录下（如：**../blog/themes/yilia/**）执行推送更新命令</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">$ git pull</span><br></pre></td></tr></table></figure>

<p>然后返回到文件夹 ../blog 下，每次修改完配置文件，需要重新部署项目</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line">$ hexo clean</span><br><span class="line">$ hexo generate</span><br><span class="line">$ hexo deploy</span><br></pre></td></tr></table></figure>



<h2 id="hexo看板娘"><a href="#hexo看板娘" class="headerlink" title="hexo看板娘"></a>hexo看板娘</h2><p>在最外层的配置文件内添加如下内容</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br></pre></td><td class="code"><pre><span class="line"># hexo看板娘：https://github.com/EYHN/hexo-helper-live2d</span><br><span class="line"># 其他模型：https://github.com/xiazeyu/live2d-widget-models</span><br><span class="line"># 模型预览：https://huaji8.top/post/live2d-plugin-2.0/</span><br><span class="line"># 白猫：tororo，黑猫：hijiki，妹妹：shizuku，水手：haruto/koharu</span><br><span class="line"># 模型安装命令</span><br><span class="line"># npm install --save hexo-helper-live2d</span><br><span class="line"># npm install --save live2d-widget-model-tororo</span><br><span class="line"># 在hexo的_config.yml的文件下添加(非主题配置文件)</span><br><span class="line">live2d:</span><br><span class="line">  enable: true</span><br><span class="line">  scriptFrom: local</span><br><span class="line">  pluginRootPath: live2dw/</span><br><span class="line">  pluginJsPath: lib/</span><br><span class="line">  pluginModelPath: assets/</span><br><span class="line">  # 标签模式, 是否仅替换 live2d tag标签而非插入到所有页面中</span><br><span class="line">  tagMode: false</span><br><span class="line">  debug: false</span><br><span class="line">  # 更换模型</span><br><span class="line">  # 使用 npm install 模型的包名 来安装,然后将包名输入位于 _config.yml 的 model.use 中.</span><br><span class="line">  model:</span><br><span class="line">    use: live2d-widget-model-hijiki</span><br><span class="line">    #use: live2d-widget-model-tororo</span><br><span class="line">  display:</span><br><span class="line">    position: right</span><br><span class="line">    width: 150</span><br><span class="line">    height: 300</span><br><span class="line">    hOffset: 40</span><br><span class="line">    vOffset: -38</span><br><span class="line">  # 手机是否显示</span><br><span class="line">  mobile:</span><br><span class="line">    show: false</span><br><span class="line">    scale: 0.2</span><br><span class="line">  # 透明度</span><br><span class="line">  react:</span><br><span class="line">    opacityDefault: 0.8</span><br><span class="line">    opacityOnHover: 0.2</span><br></pre></td></tr></table></figure>



<p>效果如下：</p>
<p><img src="https://gitee.com/chenyy-2017/pic/raw/master/note/20210413210424.png"></p>
<h2 id="搭建问题"><a href="#搭建问题" class="headerlink" title="搭建问题"></a>搭建问题</h2><h3 id="字符乱码"><a href="#字符乱码" class="headerlink" title="字符乱码"></a>字符乱码</h3><p><strong>在head标签中添加 ，指定字符集来解决</strong></p>
<p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/wodexk/p/10278801.html">https://www.cnblogs.com/wodexk/p/10278801.html</a></p>
<h2 id="博客侧边栏跳转失败"><a href="#博客侧边栏跳转失败" class="headerlink" title="博客侧边栏跳转失败"></a>博客侧边栏跳转失败</h2><p>1、修改博客主题的配置文件_config.yml，一般会有菜单配置，根据需要修改即可</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"># 侧边栏菜单</span><br><span class="line">menu:</span><br><span class="line">  主页: /</span><br><span class="line">  文章: /archives</span><br><span class="line">  分类: /categories</span><br><span class="line">  标签: /tags</span><br><span class="line">  收藏: /tags/book</span><br><span class="line">  关于我: /about/me</span><br></pre></td></tr></table></figure>



<p>2、根据菜单，在博客目录下创建source文件夹</p>
<p><img src="https://gitee.com/chenyy-2017/pic/raw/master/note/20210413205901.png"></p>
<p>3、每个文件夹下创建一个index.md文件，categories文件夹里面内容如下</p>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">---</span><br><span class="line">title: categories</span><br><span class="line">type: &quot;categories&quot;</span><br><span class="line">layout: &quot;categories&quot;</span><br><span class="line">---</span><br></pre></td></tr></table></figure>





<p>参考：</p>
<p>使用Node.js+Hexo+Github搭建个人博客：<a target="_blank" rel="noopener" href="https://www.cnblogs.com/wumz/p/8030244.html">https://www.cnblogs.com/wumz/p/8030244.html</a></p>
<p>使用Hexo、Node.js、Gitee搭建个人博客：<a target="_blank" rel="noopener" href="https://wxtsy.gitee.io/2020/07/06/blog/%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A220200706/">https://wxtsy.gitee.io/2020/07/06/blog/%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A220200706/</a></p>
<p>三分钟在GitHub上搭建个人博客：<a target="_blank" rel="noopener" href="https://zhuanlan.zhihu.com/p/28321740">https://zhuanlan.zhihu.com/p/28321740</a></p>
<p>用github page搭建博客：<a target="_blank" rel="noopener" href="https://www.zhihu.com/question/59088760">https://www.zhihu.com/question/59088760</a></p>
 
      <!-- reward -->
      
      <div id="reword-out">
        <div id="reward-btn">
          打赏
        </div>
      </div>
      
    </div>
    

    <!-- copyright -->
    
    <div class="declare">
      <ul class="post-copyright">
        <li>
          <i class="ri-copyright-line"></i>
          <strong>版权声明： </strong>
          
          本博客所有文章除特别声明外，著作权归作者所有。转载请注明出处！
          
        </li>
      </ul>
    </div>
    
    <footer class="article-footer">
       
<div class="share-btn">
      <span class="share-sns share-outer">
        <i class="ri-share-forward-line"></i>
        分享
      </span>
      <div class="share-wrap">
        <i class="arrow"></i>
        <div class="share-icons">
          
          <a class="weibo share-sns" href="javascript:;" data-type="weibo">
            <i class="ri-weibo-fill"></i>
          </a>
          <a class="weixin share-sns wxFab" href="javascript:;" data-type="weixin">
            <i class="ri-wechat-fill"></i>
          </a>
          <a class="qq share-sns" href="javascript:;" data-type="qq">
            <i class="ri-qq-fill"></i>
          </a>
          <a class="douban share-sns" href="javascript:;" data-type="douban">
            <i class="ri-douban-line"></i>
          </a>
          <!-- <a class="qzone share-sns" href="javascript:;" data-type="qzone">
            <i class="icon icon-qzone"></i>
          </a> -->
          
          <a class="facebook share-sns" href="javascript:;" data-type="facebook">
            <i class="ri-facebook-circle-fill"></i>
          </a>
          <a class="twitter share-sns" href="javascript:;" data-type="twitter">
            <i class="ri-twitter-fill"></i>
          </a>
          <a class="google share-sns" href="javascript:;" data-type="google">
            <i class="ri-google-fill"></i>
          </a>
        </div>
      </div>
</div>

<div class="wx-share-modal">
    <a class="modal-close" href="javascript:;"><i class="ri-close-circle-line"></i></a>
    <p>扫一扫，分享到微信</p>
    <div class="wx-qrcode">
      <img src="//api.qrserver.com/v1/create-qr-code/?size=150x150&data=http://example.com/2021/02/02/blog/%E4%BD%BF%E7%94%A8Git%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/" alt="微信分享二维码">
    </div>
</div>

<div id="share-mask"></div>  
  <ul class="article-tag-list" itemprop="keywords"><li class="article-tag-list-item"><a class="article-tag-list-link" href="/tags/blog/" rel="tag">blog</a></li></ul>

    </footer>
  </div>

   
  <nav class="article-nav">
    
      <a href="/2021/02/07/cache/%E7%94%B5%E5%95%86%E8%AF%A6%E6%83%85%E9%A1%B5%E7%BC%93%E5%AD%98%E6%9E%B6%E6%9E%84%EF%BC%88%E4%B8%80%EF%BC%89%E7%94%B5%E5%95%86%E7%BD%91%E7%AB%99%E7%9A%84%E5%95%86%E5%93%81%E8%AF%A6%E6%83%85%E9%A1%B5%E6%9E%B6%E6%9E%84/" class="article-nav-link">
        <strong class="article-nav-caption">上一篇</strong>
        <div class="article-nav-title">
          
            电商详情页缓存架构（一）电商网站的商品详情页架构
          
        </div>
      </a>
    
    
      <a href="/2021/02/02/blog/hello-world/" class="article-nav-link">
        <strong class="article-nav-caption">下一篇</strong>
        <div class="article-nav-title">Hello Hexo</div>
      </a>
    
  </nav>

   
<!-- valine评论 -->
<div id="vcomments-box">
  <div id="vcomments"></div>
</div>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/valine@1.4.14/dist/Valine.min.js"></script>
<script>
  new Valine({
    el: "#vcomments",
    app_id: "",
    app_key: "",
    path: window.location.pathname,
    avatar: "monsterid",
    placeholder: "给我的文章加点评论吧~",
    recordIP: true,
  });
  const infoEle = document.querySelector("#vcomments .info");
  if (infoEle && infoEle.childNodes && infoEle.childNodes.length > 0) {
    infoEle.childNodes.forEach(function (item) {
      item.parentNode.removeChild(item);
    });
  }
</script>
<style>
  #vcomments-box {
    padding: 5px 30px;
  }

  @media screen and (max-width: 800px) {
    #vcomments-box {
      padding: 5px 0px;
    }
  }

  #vcomments-box #vcomments {
    background-color: #fff;
  }

  .v .vlist .vcard .vh {
    padding-right: 20px;
  }

  .v .vlist .vcard {
    padding-left: 10px;
  }
</style>

 
   
     
</article>

</section>
      <footer class="footer">
  <div class="outer">
    <ul>
      <li>
        Copyrights &copy;
        2021
        <i class="ri-heart-fill heart_icon"></i> Chenyy
      </li>
    </ul>
    <ul>
      <li>
        
      </li>
    </ul>
    <ul>
      <li>
        
        
        <span>
  <span><i class="ri-user-3-fill"></i>访问人数:<span id="busuanzi_value_site_uv"></span></s>
  <span class="division">|</span>
  <span><i class="ri-eye-fill"></i>浏览次数:<span id="busuanzi_value_page_pv"></span></span>
</span>
        
      </li>
    </ul>
    <ul>
      
    </ul>
    <ul>
      
    </ul>
    <ul>
      <li>
        <!-- cnzz统计 -->
        
        <script type="text/javascript" src='https://s9.cnzz.com/z_stat.php?id=1278069914&amp;web_id=1278069914'></script>
        
      </li>
    </ul>
  </div>
</footer>
      <div class="float_btns">
        <div class="totop" id="totop">
  <i class="ri-arrow-up-line"></i>
</div>

<div class="todark" id="todark">
  <i class="ri-moon-line"></i>
</div>

      </div>
    </main>
    <aside class="sidebar on">
      <button class="navbar-toggle"></button>
<nav class="navbar">
  
  <div class="logo">
    <a href="/"><img src="/images/ayer-side.svg" alt="ChenyyのBlog"></a>
  </div>
  
  <ul class="nav nav-main">
    
    <li class="nav-item">
      <a class="nav-item-link" href="/">主页</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/archives">文章</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/categories">分类</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags">标签</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/tags/book">收藏</a>
    </li>
    
    <li class="nav-item">
      <a class="nav-item-link" href="/about/me">关于我</a>
    </li>
    
  </ul>
</nav>
<nav class="navbar navbar-bottom">
  <ul class="nav">
    <li class="nav-item">
      
      <a class="nav-item-link nav-item-search"  title="搜索">
        <i class="ri-search-line"></i>
      </a>
      
      
      <a class="nav-item-link" target="_blank" href="/atom.xml" title="RSS Feed">
        <i class="ri-rss-line"></i>
      </a>
      
    </li>
  </ul>
</nav>
<div class="search-form-wrap">
  <div class="local-search local-search-plugin">
  <input type="search" id="local-search-input" class="local-search-input" placeholder="Search...">
  <div id="local-search-result" class="local-search-result"></div>
</div>
</div>
    </aside>
    <script>
      if (window.matchMedia("(max-width: 768px)").matches) {
        document.querySelector('.content').classList.remove('on');
        document.querySelector('.sidebar').classList.remove('on');
      }
    </script>
    <div id="mask"></div>

<!-- #reward -->
<div id="reward">
  <span class="close"><i class="ri-close-line"></i></span>
  <p class="reward-p"><i class="ri-cup-line"></i>请我喝杯咖啡吧~</p>
  <div class="reward-box">
    
    
  </div>
</div>
    
<script src="/js/jquery-2.0.3.min.js"></script>


<script src="/js/lazyload.min.js"></script>

<!-- Tocbot -->


<script src="/js/tocbot.min.js"></script>

<script>
  tocbot.init({
    tocSelector: '.tocbot',
    contentSelector: '.article-entry',
    headingSelector: 'h1, h2, h3, h4, h5, h6',
    hasInnerContainers: true,
    scrollSmooth: true,
    scrollContainer: 'main',
    positionFixedSelector: '.tocbot',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto'
  });
</script>

<script src="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/jquery-modal@0.9.2/jquery.modal.min.css">
<script src="https://cdn.jsdelivr.net/npm/justifiedGallery@3.7.0/dist/js/jquery.justifiedGallery.min.js"></script>

<script src="/dist/main.js"></script>

<!-- ImageViewer -->

<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--share" style="display:none" title="Share"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>

                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css">
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script>
    function viewer_init() {
        let pswpElement = document.querySelectorAll('.pswp')[0];
        let $imgArr = document.querySelectorAll(('.article-entry img:not(.reward-img)'))

        $imgArr.forEach(($em, i) => {
            $em.onclick = () => {
                // slider展开状态
                // todo: 这样不好，后面改成状态
                if (document.querySelector('.left-col.show')) return
                let items = []
                $imgArr.forEach(($em2, i2) => {
                    let img = $em2.getAttribute('data-idx', i2)
                    let src = $em2.getAttribute('data-target') || $em2.getAttribute('src')
                    let title = $em2.getAttribute('alt')
                    // 获得原图尺寸
                    const image = new Image()
                    image.src = src
                    items.push({
                        src: src,
                        w: image.width || $em2.width,
                        h: image.height || $em2.height,
                        title: title
                    })
                })
                var gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, {
                    index: parseInt(i)
                });
                gallery.init()
            }
        })
    }
    viewer_init()
</script>

<!-- MathJax -->

<!-- Katex -->

<!-- busuanzi  -->


<script src="/js/busuanzi-2.3.pure.min.js"></script>


<!-- ClickLove -->

<!-- ClickBoom1 -->

<!-- ClickBoom2 -->

<!-- CodeCopy -->


<link rel="stylesheet" href="/css/clipboard.css">

<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script>
  function wait(callback, seconds) {
    var timelag = null;
    timelag = window.setTimeout(callback, seconds);
  }
  !function (e, t, a) {
    var initCopyCode = function(){
      var copyHtml = '';
      copyHtml += '<button class="btn-copy" data-clipboard-snippet="">';
      copyHtml += '<i class="ri-file-copy-2-line"></i><span>COPY</span>';
      copyHtml += '</button>';
      $(".highlight .code pre").before(copyHtml);
      $(".article pre code").before(copyHtml);
      var clipboard = new ClipboardJS('.btn-copy', {
        target: function(trigger) {
          return trigger.nextElementSibling;
        }
      });
      clipboard.on('success', function(e) {
        let $btn = $(e.trigger);
        $btn.addClass('copied');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-checkbox-circle-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPIED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-checkbox-circle-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
      clipboard.on('error', function(e) {
        e.clearSelection();
        let $btn = $(e.trigger);
        $btn.addClass('copy-failed');
        let $icon = $($btn.find('i'));
        $icon.removeClass('ri-file-copy-2-line');
        $icon.addClass('ri-time-line');
        let $span = $($btn.find('span'));
        $span[0].innerText = 'COPY FAILED';
        
        wait(function () { // 等待两秒钟后恢复
          $icon.removeClass('ri-time-line');
          $icon.addClass('ri-file-copy-2-line');
          $span[0].innerText = 'COPY';
        }, 2000);
      });
    }
    initCopyCode();
  }(window, document);
</script>


<!-- CanvasBackground -->


    
  </div>
</body>

</html>